# -*- coding: UTF-8 -*-
"""
@Time : 2022/12/5
@Author : Gloria
"""
from django.contrib import admin
from django.utils.safestring import mark_safe

from app01.models import Cover

# 文章封面
class CoverAdmin(admin.ModelAdmin):
    def get_cover(self: Cover):
        if self.url:
            return mark_safe(f"""<img src="{self.url.url}" style="height:60px; border-radius:5px">""")

    get_cover.short_description = '文章封面'

    list_display = [get_cover, 'url']